import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

/* Layout */
import Layout from "@/layout";

/**
 * Note: 路由配置项
 *
 * hidden: true                     // 当设置 true 的时候该路由不会再侧边栏出现 如401，login等页面，或者如一些编辑页面/edit/1
 * alwaysShow: true                 // 当你一个路由下面的 children 声明的路由大于1个时，自动会变成嵌套的模式--如组件页面
 *                                  // 只有一个时，会将那个子路由当做根路由显示在侧边栏--如引导页面
 *                                  // 若你想不管路由下面的 children 声明的个数都显示你的根路由
 *                                  // 你可以设置 alwaysShow: true，这样它就会忽略之前定义的规则，一直显示根路由
 * redirect: noRedirect             // 当设置 noRedirect 的时候该路由在面包屑导航中不可被点击
 * name:'router-name'               // 设定路由的名字，一定要填写不然使用<keep-alive>时会出现各种问题
 * query: '{"id": 1, "name": "ry"}' // 访问路由的默认传递参数
 * meta : {
    noCache: true                   // 如果设置为true，则不会被 <keep-alive> 缓存(默认 false)
    title: 'title'                  // 设置该路由在侧边栏和面包屑中展示的名字
    icon: 'svg-name'                // 设置该路由的图标，对应路径src/assets/icons/svg
    breadcrumb: false               // 如果设置为false，则不会在breadcrumb面包屑中显示
    activeMenu: '/system/user'      // 当路由设置了该属性，则会高亮相对应的侧边栏。
  }
 */

// 公共路由
export const constantRoutes = [{
        path: "/redirect",
        component: Layout,
        hidden: true,
        children: [{
            path: "/redirect/:path(.*)",
            component: () =>
                import ("@/views/redirect"),
        }, ],
    },
    {
        path: "/login",
        component: () =>
            import ("@/views/login"),
        hidden: true,
    },
    {
        path: "/register",
        component: () =>
            import ("@/views/register"),
        hidden: true,
    },
    {
        path: "/404",
        component: () =>
            import ("@/views/error/404"),
        hidden: true,
    },
    {
        path: "/401",
        component: () =>
            import ("@/views/error/401"),
        hidden: true,
    },
    {
        path: "",
        component: Layout,
        redirect: "index",
        children: [{
            path: "index",
            component: () =>
                import ("@/views/index"),
            name: "Index",
            meta: { title: "首页1", icon: "dashboard", affix: true },
        }, ],
    },

    {
        path: "",
        component: Layout,
        redirect: "dashboard",
        meta: { title: "实训资源管理", icon: "user", affix: false },
        children: [{
                path: "dashboardBarChart",
                component: () =>
                    import ("@/views/dashboard/BarChart"),
                name: "BarChart",
                meta: { title: "成员单位实训管理员管理", icon: "user" },
            },
            {
                path: "dashboardLineChart",
                component: () =>
                    import ("@/views/dashboard/LineChart"),
                name: "LineChart",
                meta: { title: "实训教师管理", icon: "user" },
            },
            {
                path: "dashboardPanelGroup",
                component: () =>
                    import ("@/views/dashboard/PanelGroup"),
                name: "PanelGroup",
                meta: { title: "实训基地管理", icon: "user" },
            },
            {
                path: "dashboardPieChart",
                component: () =>
                    import ("@/views/dashboard/PieChart"),
                name: "PieChart",
                meta: { title: "实训室管理", icon: "user" },
            },
            {
                path: "dashboardRaddarChart",
                component: () =>
                    import ("@/views/dashboard/RaddarChart"),
                name: "RaddarChart",
                meta: { title: "资产管理", icon: "user" },
            },
        ],
    },
    {
        path: "",
        component: Layout,
        redirect: "answer",
        meta: { title: "项目管理", icon: "user" },
        children: [{
                path: "answerList",
                component: () =>
                    import ("@/views/generator/answer/list"),
                name: "list",
                meta: { title: "培训申请列表", icon: "user" },
                children: []
            },
            {
                path: "answerNewly",
                component: () =>
                    import ("@/views/generator/answer/newly"),
                name: "index",
                meta: { title: "培训课程列表", icon: "user" },
            },
            {
                path: "answerIndex",
                component: () =>
                    import ("@/views/generator/answer/index"),
                name: "index",
                meta: { title: "培训成绩管理", icon: "user" },
            },
            {
                path: "answerEdit",
                component: () =>
                    import ("@/views/generator/answer/edit"),
                name: "index",
                meta: { title: "编辑培训课程", icon: "user" },
            },
            {
                path: "answerSee",
                component: () =>
                    import ("@/views/generator/answer/see"),
                name: "index",
                meta: { title: "查看培训课程", icon: "user" },
            },
            {
                path: "answerExamine",
                component: () =>
                    import ("@/views/generator/answer/examine"),
                name: "index",
                meta: { title: "审核报名", icon: "user" },
            },
        ],
    },
    {
        path: "/dashboard",
        component: Layout,
        hidden: true,
        redirect: "noredirect",
        children: [{
            path: "dashboardPie",
            component: () =>
                import ("@/views/dashboard/son/pie"),
            name: "dashboard",
            meta: { title: "开放时间设置", icon: "dashboard" },
        }, ],
    },
    {
        path: "/generator/answer",
        component: Layout,
        hidden: true,
        redirect: "noredirect",
        children: [{
            path: "answerSee",
            component: () =>
                import ("@/views/generator/answer/see"),
            name: "see",
            meta: { title: "新增培训课程", icon: "user" },
        }, ],
    },
    // {
    //   path: "/practical",
    //   component: Layout,
    //   hidden: true,
    //   redirect: "noredirect",
    //   children: [
    //     {
    //       path: "practicalTrainingBase",
    //       component: () => import("@/views/practical/trainingBase"),
    //       name: "Profile",
    //       meta: { title: "实训基地管理", icon: "practical" },
    //     },
    //   ],
    // },
    // {
    //   path: "/practical",
    //   component: Layout,
    //   hidden: true,
    //   redirect: "noredirect",
    //   children: [
    //     {
    //       path: "practicalTraining",
    //       component: () => import("@/views/practical/training"),
    //       name: "Profile",
    //       meta: { title: "实训室管理", icon: "practical" },
    //     },
    //   ],
    // },
    // {
    //   path: "/practical",
    //   component: Layout,
    //   hidden: true,
    //   redirect: "noredirect",
    //   children: [
    //     {
    //       path: "practicalAsset",
    //       component: () => import("@/views/practical/asset"),
    //       name: "Profile",
    //       meta: { title: "资产管理", icon: "practical" },
    //     },
    //   ],
    // },
    // {
    //   path: "/personnel/library",
    //   component: Layout,
    //   hidden: true,
    //   redirect: "noredirect",
    //   children: [
    //     {
    //       path: "libraryInformation",
    //       component: () => import("@/views/personnel/library/information"),
    //       name: "Profile",
    //       meta: { title: "信息管理", icon: "practical" },
    //     },
    //   ],
    // },
    // {
    //   path: "/practical",
    //   component: Layout,
    //   hidden: true,
    //   redirect: "noredirect",
    //   children: [
    //     {
    //       path: "practicalAllocation",
    //       component: () => import("@/views/practical/allocation"),
    //       name: "Profile",
    //       meta: { title: "资产调拨申请列表", icon: "practical" },
    //     },
    //   ],
    // },
    // {
    //   path: "/intelligence",
    //   component: Layout,
    //   hidden: true,
    //   redirect: "noredirect",
    //   children: [
    //     {
    //       path: "profile",
    //       component: () => import("@/views/system/intelligence/profile/index"),
    //       name: "Profile",
    //       meta: { title: "智能助手", icon: "intelligence" },
    //     },
    //   ],
    // },
    // {
    //   path: "/news",
    //   component: Layout,
    //   hidden: true,
    //   redirect: "noredirect",
    //   children: [
    //     {
    //       path: "profileIndex", //路由名
    //       component: () => import("@/views/system/news/profile/index"), //指向地址
    //       name: "Profile",
    //       meta: { title: "未读日报", icon: "news" },
    //     },
    //   ],
    // },
    // {
    //   path: "/news",
    //   component: Layout,
    //   hidden: true,
    //   redirect: "noredirect",
    //   children: [
    //     {
    //       path: "profileWork", //路由名
    //       component: () => import("@/views/system/news/profile/work"), //指向地址
    //       name: "Profile",
    //       meta: { title: "待办工单", icon: "news" },
    //     },
    //   ],
    // },
    // {
    //   path: "/news",
    //   component: Layout,
    //   hidden: true,
    //   redirect: "noredirect",
    //   children: [
    //     {
    //       path: "profileSchedule", //路由名
    //       component: () => import("@/views/system/news/profile/schedule"), //指向地址
    //       name: "Profile",
    //       meta: { title: "今日日程", icon: "news" },
    //     },
    //   ],
    // },
    // {
    //   path: "/news",
    //   component: Layout,
    //   hidden: true,
    //   redirect: "noredirect",
    //   children: [
    //     {
    //       path: "profileApply", //路由名
    //       component: () => import("@/views/system/news/profile/apply"), //指向地址
    //       name: "Profile",
    //       meta: { title: "待批申请", icon: "news" },
    //     },
    //   ],
    // },
    // {
    //   path: "/news",
    //   component: Layout,
    //   hidden: true,
    //   redirect: "noredirect",
    //   children: [
    //     {
    //       path: "profileNotice", //路由名
    //       component: () => import("@/views/system/news/profile/notice"), //指向地址
    //       name: "Profile",
    //       meta: { title: "系统通知", icon: "news" },
    //     },
    //   ],
    // },
    // {
    //   path: "/news",
    //   component: Layout,
    //   hidden: true,
    //   redirect: "noredirect",
    //   children: [
    //     {
    //       path: "profileTask",
    //       component: () => import("@/views/system/news/profile/task"),
    //       name: "Profile",
    //       meta: { title: "待办任务", icon: "news" },
    //     },
    //   ],
    // },
    {
        path: "/system/user-auth",
        component: Layout,
        hidden: true,
        children: [{
            path: "role/:userId(\\d+)",
            component: () =>
                import ("@/views/system/user/authRole"),
            name: "AuthRole",
            meta: { title: "角色管理", activeMenu: "/system/user" },
        }, ],
    },
    {
        path: "/system/role-auth",
        component: Layout,
        hidden: true,
        children: [{
            path: "user/:roleId(\\d+)",
            component: () =>
                import ("@/views/system/role/authUser"),
            name: "AuthUser",
            meta: { title: "企业管理", activeMenu: "/system/role" },
        }, ],
    },
    {
        path: "/system/dict-data",
        component: Layout,
        hidden: true,
        children: [{
            path: "index/:dictId(\\d+)",
            component: () =>
                import ("@/views/system/dict/data"),
            name: "Data",
            meta: { title: "广告管理", activeMenu: "/system/dict" },
        }, ],
    },
    {
        path: "/monitor/job-log",
        component: Layout,
        hidden: true,
        children: [{
            path: "index",
            component: () =>
                import ("@/views/monitor/job/log"),
            name: "JobLog",
            meta: { title: "权限管理", activeMenu: "/monitor/job" },
        }, ],
    },
    {
        path: "/tool/gen-edit",
        component: Layout,
        hidden: true,
        children: [{
            path: "index",
            component: () =>
                import ("@/views/tool/gen/editTable"),
            name: "GenEdit",
            meta: { title: "日志管理", activeMenu: "/tool/gen" },
        }, ],
    },
];

export default new Router({
    mode: "history", // 去掉url中的#
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes,
});